<?php


namespace part16_StateMode\Code4;

/**
 * 中午工作状态
 */
class NoonState extends State
{

    public function writeProgram($work)
    {
        if ($work->getHour() < 13) {
            echo "当前时间：{$work->getHour()} 点 饿了，午饭；犯困，午休\n";
        } else {
            // 超过13点，转入下午工作状态
            $work->setState(new AfternoonState());
            $work->writeProgram();
        }
    }
}